import { VxeGridPropTypes } from '@/components/VxeTable';
import { Tag } from 'ant-design-vue';

export default [
  {
    title: '触发器编号',
    width: 180,
    field: 'triggerId'
  },
  {
    title: '类型',
    width: 120,
    field: 'triggerType'
  },
  {
    title: '程序集',
    width: 120,
    field: 'assemblyName'
  },
  {
    title: '参数',
    width: 120,
    field: 'args'
  },
  {
    title: '描述',
    width: 120,
    field: 'description'
  },
  {
    title: '状态',
    width: 120,
    field: 'status',
    slots: {
      default({ row }) {
        return [
          <Tag visible={row.status == 0} color="warning">
            积压
          </Tag>,
          <Tag visible={row.status == 1} color="">
            就绪
          </Tag>,
          <Tag visible={row.status == 2} color="success">
            正在运行
          </Tag>,
          <Tag visible={row.status == 3} color="error">
            暂停
          </Tag>,
          <Tag visible={row.status == 4} color="error">
            阻塞
          </Tag>,
          <Tag visible={row.status == 5} color="">
            由失败进入就绪
          </Tag>,
          <Tag visible={row.status == 6} color="error">
            归档
          </Tag>,
          <Tag visible={row.status == 7} color="error">
            崩溃
          </Tag>,
          <Tag visible={row.status == 8} color="error">
            超限
          </Tag>,
          <Tag visible={row.status == 9} color="error">
            无触发时间
          </Tag>,
          <Tag visible={row.status == 10} color="error">
            未启动
          </Tag>,
          <Tag visible={row.status == 11} color="error">
            未知作业触发器
          </Tag>,
          <Tag visible={row.status == 12} color="error">
            未知作业处理程序
          </Tag>
        ];
      }
    }
  },
  {
    title: '起始时间',
    width: 120,
    field: 'startTime'
  },
  {
    title: '结束时间',
    width: 120,
    field: 'endTime'
  },
  {
    title: '最近运行时间',
    width: 120,
    field: 'lastRunTime'
  },
  {
    title: '下一次运行时间',
    width: 120,
    field: 'nextRunTime'
  },
  {
    title: '触发次数',
    width: 120,
    field: 'numberOfRuns'
  },
  {
    title: '最大触发次数',
    width: 120,
    field: 'maxNumberOfRuns'
  },
  {
    title: '出错次数',
    width: 120,
    field: 'numberOfErrors'
  },
  {
    title: '重试间隔ms',
    width: 120,
    field: 'retryTimeout'
  },
  {
    title: '立即启动',
    width: 120,
    field: 'startNow',
    slots: {
      default({ row }) {
        return [
          <Tag visible={row.startNow == true}> 是 </Tag>,
          <Tag color="blue">否</Tag>
        ];
      }
    }
  },
  {
    title: '启动时执行一次',
    field: 'runOnStart',
    width: 120,
    slots: {
      default({ row }) {
        return [
          <Tag visible={row.runOnStart == true}> 是 </Tag>,
          <Tag color="blue">否</Tag>
        ];
      }
    }
  },
  {
    title: '重置触发次数',
    field: 'resetOnlyOnce',
    width: 120,
    slots: {
      default({ row }) {
        return [
          <Tag visible={row.resetOnlyOnce == true}> 是 </Tag>,
          <Tag color="blue">否</Tag>
        ];
      }
    }
  },
  {
    width: 180,
    title: '操作',
    align: 'center',
    slots: { default: 'action' },
    fixed: 'right'
  }
] as VxeGridPropTypes.Columns;
